<template>

    <div class="item">
<!--        <div class="img" :style="imgStyle">-->

<!--        </div>-->

        <el-image class="img" :src="data.ImgUrl" :fit="fit">
            <template #error>
                <div class="image-slot" :style="imgStyle"></div>
            </template>
        </el-image>


        <div class="content">

            <div class="title">{{data.Title}}</div>
            <div class="type">VLOG</div>
            <div class="desc">
                {{data.Description}}
            </div>

            <div class="collect_and_support">
                <span class="iconfont icon-shoucangjia myiconColl"></span>
                <span class="number">{{data.CollectionNum}}</span>

                <span class="iconfont icon-dianzan1 myiconSupp"></span>
                <span class="number">{{data.SupportNum}}</span>

            </div>

            <div class="avtor_and_price">
                <div class="avtor_and_name">
<!--                    <el-avatar :size="40" src="https://img2.baidu.com/it/u=3666548066,2508071679&fm=26&fmt=auto"></el-avatar>-->
                    <img v-if="data.UserAvatar == null" src="https://img2.baidu.com/it/u=3666548066,2508071679&fm=26&fmt=auto" class="UserAvatar">
                    <img v-else class="UserAvatar" :src="UserAvatar">
                    <div class="name">{{data.Publisher}}</div>
                </div>

                <div class="price" v-if="(data.Price == null) || (data.Price == undefined)">
                    免费
                </div>

                <div class="price" v-else>
                    ￥{{data.Price}}
                </div>

            </div>

        </div>

    </div>

</template>

<script>
    import baseConfig from "../../utils/config";
    export default {
        name: "item2",
        props:{
            data:{
                type:Object,
                default:{}
            }
        },
        computed:{
          UserAvatar(){
            return baseConfig.dev+this.data.UserAvatar
          }
        },
        data(){
            return{
                imgStyle:{
                    background: 'url(' + require("@/assets/img/profile_1.png") + ")",
                    backgroundSize: '100% 100%',
                    backgroundRepeat: 'no-repeat',
                }
            }
        }
    }
</script>

<style scoped>
    .item{
        width: 370px;
        height: 487px;
        background: #FFFFFF;
    }
    .img{
        width: 370px;
        height: 250px;
    }
    .image-slot{
        width: 370px;
        height: 250px;
    }

    .content{
        margin-top: 14px;

    }
    .title{
        font-size: 16px;
        font-family: Microsoft YaHei;
        font-weight: bold;
        line-height: 16px;
        color: #333333;
        opacity: 1;
        margin-left: 14px;
        margin-right: 14px;

        /*文本溢出省略号*/
        overflow: hidden;
        text-overflow:ellipsis;
        white-space: nowrap;
    }
    .type{
        font-size: 12px;
        font-family: Microsoft YaHei;
        font-weight: 400;

        color: #BBBBBB;
        opacity: 1;
        margin-top: 6px;
        margin-left: 14px;
        margin-right: 14px;
    }
    .desc{
        margin-top: 14px;
        font-size: 14px;
        font-family: Microsoft YaHei;
        font-weight: 400;
        line-height: 18px;
        color: #666666;
        opacity: 1;
        height: 37px;

        /*多行文本溢出省略号*/
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        overflow: hidden;
        margin-left: 14px;
        margin-right: 14px;
    }
    .collect_and_support{
        margin-top: 27px;
        margin-left: 14px;
        margin-right: 14px;
    }
    .myiconColl{
        margin-top: 24px;
        color: #BBBBBB;
    }
    .number{
        font-size: 14px;
        font-family: Microsoft YaHei;
        font-weight: 400;
        line-height: 14px;
        color: #BBBBBB;
        opacity: 1;
        margin-left: 7px;
        margin-top: 24px;
    }
    .myiconSupp{
        margin-top: 27px;
        color: #BBBBBB;
        margin-left: 15px;
    }
    .avtor_and_price{
        /*margin-top: 24px;*/
        height: 60px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-top: 1px solid #E5E5E5;
    }
    .avtor_and_name{
        display: flex;
        align-items: center;
        margin-left: 14px;
    }
    .UserAvatar{
        width: 30px;
        height: 30px;
        border-radius: 50%;
        object-fit: fill;
    }
    .name{
        font-size: 14px;
        font-family: Microsoft YaHei;
        font-weight: 400;
        line-height: 0px;
        color: #333333;
        opacity: 1;
        margin-left: 10px;
    }
    .price{
        font-size: 18px;
        font-family: Microsoft YaHei;
        font-weight: bold;
        line-height: 0px;
        color: #FF4A3B;
        opacity: 1;

        margin-right: 14px;
    }
</style>
